from django.db import models
from mdeditor.fields import MDTextField

# Create your models here.

class Teacher(models.Model):
	name = models.CharField(max_length=20)
	last_year = models.CharField(max_length=30)
	host_year = models.CharField(max_length=30)
	teacher_intro = MDTextField()
	subject = models.CharField(max_length=20)
	teacher_id = models.IntegerField()
	last_edit = models.DateTimeField(auto_now=True)
	last_edit_name = models.CharField(max_length=100)

	def __str__(self):
		return self.subject + self.name

class TeacherHistory(models.Model):
	name = models.CharField(max_length=20)
	last_year = models.CharField(max_length=30)
	host_year = models.CharField(max_length=30)
	teacher_intro = MDTextField()
	subject = models.CharField(max_length=20)
	last_edit_name = models.CharField(max_length=20)
	last_edit_date = models.DateTimeField()
	history = models.ForeignKey(Teacher, on_delete=models.CASCADE, null=True, blank=True, related_name='history')
